<div class = "main-view">

    <div class="left-margin top-margin"><strong class="am-text-primary am-text-lg">数据同步</strong></div>
    <br>

    <form class="am-form-inline left-margin top-margin" role="form">

        <div  class="top-margin">
            <label class="left-margin">发布时间:</label>
            <input type="text" id="startDate" class="form-control datepicker" size="12" data-date-format="yyyy-mm-dd">
            <label class="left-margin">至：</label>
            <input type="text" id="endDate" class="form-control datepicker" size="12" data-date-format="yyyy-mm-dd">

        </div>

    </form>

    <br>
    <button type="submit" data-am-modal="{target: '#loading'}" class="am-btn am-btn-primary" style="margin-left: 50px" ng-click="secondHand()" data-target = "cascad-search">二手数据同步</button>

    <div class="am-modal am-modal-loading am-modal-no-btn" id="loading">
        <div class="am-modal-dialog">
            <div class="am-modal-hd">正在载入...</div>
            <div class="am-modal-bd">
                <span class="am-icon-spinner am-icon-spin"></span>
            </div>
        </div>
    </div>

</div>

<script>
    Date.prototype.format = function (format) {
        var o = {
            "M+": this.getMonth() + 1, //month
            "d+": this.getDate(), //day
            "h+": this.getHours(), //hour
            "m+": this.getMinutes(), //minute
            "s+": this.getSeconds(), //second
            "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
            "S": this.getMilliseconds() //millisecond
        }
        if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
                (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o) if (new RegExp("(" + k + ")").test(format))
            format = format.replace(RegExp.$1,
                    RegExp.$1.length == 1 ? o[k] :
                            ("00" + o[k]).substr(("" + o[k]).length));
        return format;
    }

    var fromDate = $('#startDate').datepicker().on('changeDate', function (ev) {
        //alert(ev.date.format('yyyy-MM-dd'));
        //$scope.startDate=ev.date.format('yyyy-MM-dd');
        $("#startDate").val(ev.date.format('yyyy-MM-dd'));
//        alert(ev.date);
    });

    var toDate = $('#endDate').datepicker().on('changeDate', function (ev) {
        // alert(ev.date.format('yyyy-MM-dd'));
        //$scope.endDate=ev.date.format('yyyy-MM-dd');
        $("#endDate").val(ev.date.format('yyyy-MM-dd'));
    });

    var hideContent = function(obj){
        $("#display_hide_content").css("display","block");
        $("#display_hide_content1").text(obj.innerText);
        $("#display_hide_content")[0].style.left = obj.offsetLeft + "px";
        $("#display_hide_content")[0].style.top = 60 + obj.offsetTop + "px";
    };

    $("#display_hide_close").on("click",function(){
        $("#display_hide_content").css("display","none");
    });

</script>